package com.dodayum.service.impl;

import com.dodayum.dao.ServiceInformationMapper;
import com.dodayum.pojo.ServiceInformation;
import com.dodayum.service.ServiceInformationService;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ServiceInformationServiceImpl implements ServiceInformationService {

    @Resource
    private ServiceInformationMapper serviceInformationMapper;

    @Override
    public List<ServiceInformation> queryAll() {
        return serviceInformationMapper.queryAll();
    }

    @Override
    public List<ServiceInformation> query(ServiceInformation serviceInformation) {
        ServiceInformation query = new ServiceInformation();
        return serviceInformationMapper.query(query);
    }

    @Override
    public boolean insert(ServiceInformation serviceInformation) {
        return serviceInformationMapper.insert(serviceInformation);
    }

    @Override
    public boolean delete(int id) {
        return serviceInformationMapper.deleteById(id);
    }

    @Override
    public boolean updateById(ServiceInformation serviceInformation) {
        return serviceInformationMapper.updateById(serviceInformation);
    }

    @Override
    public ServiceInformation queryById(Integer serviceId) {
        if (ObjectUtils.isEmpty(serviceId)){
            return null;
        }
        return  serviceInformationMapper.queryById(serviceId);
    }

    @Override
    public List<ServiceInformation> queryServiceByServiceName(String serviceName){
        return serviceInformationMapper.queryServiceByServiceName(serviceName);
    }
}
